package com.amos.muexamclient.sys.service.dto;

import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Copyright © 2018 嘉源锐信. All rights reserved.
 *
 * @Project: mu-exam
 * @ClassName: TreeSelect
 * @Package: com.amos.muexamclient.sys.service.dto
 * @author: zhuqb
 * @Description:
 * @date: 2020/3/30 0030 下午 17:47
 * @Version: V1.0
 */
@Data
public class TreeSelect implements Serializable {
    private static final long serialVersionUID = -9118057620120178143L;
    /**
     * 节点ID
     */
    private String id;

    /**
     * 节点名称
     */
    private String label;

    /**
     * 子节点
     */
    private List<TreeSelect> children;


    public TreeSelect() {

    }

    public TreeSelect(SysMenuDTO menu) {
        this.id = menu.getId();
        this.label = menu.getMenuName();
        this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
    }

    public TreeSelect(SysDeptDTO dept) {
        this.id = dept.getId();
        this.label = dept.getDeptName();
        this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());

    }


}
